package FPGrowth

import java.io.File
import java.util

import org.apache.commons.io.FileUtils

object analyse2 {


  def main(args: Array[String]): Unit = {
    val inputFile2: String = "1ans2"
    val map=new util.HashMap[String,Int]()

    FileUtils.readLines(new File(inputFile2)).forEach(
      line=>{
        val sts = line.split("\\|")
        val supp = (sts(sts.length-1).toDouble*100000000).toInt
        val base = change(sts(0), ",")
        //        println(supp)
        //        if(sts.length==3&& !line.contains("电影"))
        val le=base+"|"+change(sts(1),",")+"|"+sts(sts.length-1)
        if(base.contains("互联网")&&base.contains("创业")&&base.contains("商业")&&base.contains("自然科学")&& !le.contains("电影"))
          if(sts(0).split(",").length==4)
            map.put(le,supp)
      }
    )
    println(map.size())
    val ls=new util.ArrayList[util.Map.Entry[String,Int]](map.entrySet())
    util.Collections.shuffle(ls)
//    ls.sort((e,a)=> -(a.getValue-e.getValue))
    ls.subList(0,math.min(ls.size(),100)).forEach(e=>println(e.getKey))
  }

  def change(str:String,split:String): String ={
    val sb=new StringBuilder
    str.split(split).foreach(e=> sb++=","+perProc.maps.get(e))
    sb.substring(1)
  }
}
